import { Catch, HttpStatus } from '@midwayjs/core';
import { MidwayValidationError } from '@midwayjs/validate';
import { Context } from '@midwayjs/koa';

@Catch(MidwayValidationError)
export class ValidateErrorFilter {
    async catch(err: MidwayValidationError, ctx: Context) {
        return {
            status: HttpStatus.UNPROCESSABLE_ENTITY,
            message: '校验参数错误,' + err.message,
        };
    }
}





